import { deleteFile, readStrFromFile, saveStrToFile } from "../utils/mirUtil";

const fileName = '缓存/R.json'

export function loadR(isReload: boolean) {
    if (isReload) {
        let str = readStrFromFile(fileName);
        let obj: any = JSON.parse(str);
        if (obj) {
            for (let key in obj) {
                GameLib.R[key] = obj[key];
            }
        }
    }
    else {
        deleteFile(fileName)
    }
}

export function saveR() {
    saveStrToFile(fileName, JSON.stringify(GameLib.R));
}